package pl.com.qapps.unity;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Scanner;

import pl.com.qapps.unity.UnityPb.Request;

/**
 * @author Jakub Dykowski
 * 
 */
class WriteFile {

	static String FILE = "src/pl/com/qapps/unity/ressources/file.txt";

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		OutputStream out = new FileOutputStream(FILE);

		Request req = null;

		out.write(47);
		out.write(req.getSerializedSize());
		req.writeTo(out);

		req = null;
		out.write(req.getSerializedSize());
		req.writeTo(out);
		out.close();
		Scanner in = new Scanner(new File(
				"src/pl/com/qapps/unity/ressources/file.txt"));
		while (in.hasNextLine())
			System.out.println(in.nextLine());
	}

	public static OutputStream getOutputStream() throws FileNotFoundException {
		return new FileOutputStream(FILE);
	}
}
